/**
 * Created with Intellij IDEA.
 * Description;
 * User:墨琦
 * Data:2023-04-03
 * Time:21:27
 */
public class Text2 {
    public static void main(String[] args) {
        MyArray<Integer> fw=new MyArray<Integer>();
        fw.setVal(0,12);
        fw.setVal(1,22);
        System.out.println(fw.getPos(0));
    }
}

class MyArray <T> {
   /*不太好的方法
    public T[] objects = (T[]) new Object[10];*/

    public Object[] objects = new Object[10];

    public T getPos(int pos) {
        return (T)objects[pos];
    }

    public void setVal(int pos,T val) {
        objects[pos] = val;
    }

    public Object[] getArray() {
        return objects;
    }
}